package prove;

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.*;

public class AggiornamentoBottoni extends JFrame implements ActionListener {
	private JButton a, b;
	private JPanel p;

	public AggiornamentoBottoni() {
		setSize(400, 400);
		p = new JPanel();
		a = new JButton("Premi 1");
		a.addActionListener(this);
		p.add(a);
		add(p);
	}

	@Override
	public void actionPerformed(ActionEvent e) {
		if (e.getSource() == a) {
			b = new JButton("Premi 2");
			p.add(b);
			this.revalidate();
		}
	}

	public static void main(String[] args) {
		new AggiornamentoBottoni().setVisible(true);
	}

}
